<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../rest.css">
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .box {
            width: 200px;
            height: 200px;
            background-color: rgba(0, 0, 0, 0.5);
            position: absolute;
            left: 100px;
            top: 100px;
        }
    </style>
</head>

<body>
    <ul class="list">
        <li>01</li>
        <li>02</li>
        <li>03</li>
        <li>04</li>
        <li>05</li>
        <li>06</li>
        <li>07</li>
        <li>08</li>
        <li>09</li>
        <li>10</li>
    </ul>
    <div class="box"></div>
</body>

<script>

    //call()
    var liList = document.querySelectorAll('.list li')
    // liList.slice()  // liList.slice is not a function   伪数组正常情况下无法使用数组的拓展方法 => 借用
    var list = Array.prototype.slice.call(liList)
    console.log(list, list instanceof Array)//转化为真数组
    /* var num = 1
    var str = "hello"
    var bool = true
    var arr = [1, 2, 3]
    var obj = { a: 1, b: 2 }
    var p = new Promise(function () { })
    var date = new Date()
    // 统一访问Object.prototype.toString() 就可以将输出格式保持一直
    console.log(Object.prototype.toString.call(num))
    console.log(Object.prototype.toString.call(str))
    console.log(Object.prototype.toString.call(bool))
    console.log(Object.prototype.toString.call(arr))
    console.log(Object.prototype.toString.call(date))
    console.log(Object.prototype.toString.call(obj))
    console.log(Object.prototype.toString.call(p))
    console.log(Object.prototype.toString.call(arr) === '[object Array]') //判断是否是数组
    console.log(Object.prototype.toString.apply(obj) === '[object Object]') // 是否是纯对象数据*/

    // apply()
    var list = [1, 4, 7, 2, 5, 8, 3, 6, 9, 0]
    var min = Math.min.apply(null, list)//因为传参的集合为apply的第二个参数，为一个数组，所以可以这么使用
    // var min = Math.min(...list)//相当于上面的过程理解，把apply的第二个参数的数组里的值作为参数传进Math.min()
    console.log(min)

        // bind
    /*dragDown: function () {
            this.target.onmousedown = function (e) {
                var e = e || window.event;
                var posX = e.offsetX;
                var posY = e.offsetY;
                this.posX = posX;
                this.posY = posY;件
                this.dragMove()
                this.dragUp()
            }.bind(this)*/
            //       ^
            //多个函数嵌套导致this指向混乱,如果想要内层函数访问外层函数的this指向:借助bind方法
</script>

</html>